<template>
  <div class="backgroundImg">
    <div style="margin: 40px">
      <el-row :gutter="20" style="margin-top:10px;">
        <el-col :span="8">
          <div class="grid-content bg-purple">
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <span>个人中心</span>
              </div>
              <div class="name-role">
                <span class="sender">{{ UserInfoStore.userName }} - {{ isAdmin }}</span>
              </div>
              <div class="registe-info">
              <span class="registe-info">
                注册时间：
                <el-icon><Clock/></el-icon>
                {{ UserInfoStore.userCreateTime }}
              </span>
              </div>
              <el-divider></el-divider>
              <div class="personal-relation">
                <div class="relation-item">手机号:
                  <div style="float: right; padding-right:20px;">{{ UserInfoStore.userPhone }}</div>
                </div>
              </div>
              <div class="personal-relation">
                <div class="relation-item">邮箱:
                  <div style="float: right; padding-right:20px;">{{ UserInfoStore.userEmail }}</div>
                </div>
              </div>
              <div class="personal-relation">
                <div class="relation-item">用户名:
                  <div style="float: right; padding-right:20px;">{{ UserInfoStore.userAccount }}</div>
                </div>
              </div>
              <div class="personal-relation">
                <div class="relation-item" style="font-size: 20px">更改用户头像:
                  <div style="float: right; padding-right:20px;margin-bottom: 40px">
                    <UserUploadImg/>
                  </div>
                </div>
              </div>

            </el-card>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple">
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <span>基本资料</span>
              </div>
              <div>
                <ChangeUserInfo/>
                <div slot="footer" class="dialog-footer">
                </div>
              </div>
            </el-card>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>

</template>

<script lang="ts" setup>
import {Clock} from '@element-plus/icons-vue'
import {useUserInfoStore} from '@/stores/User/UserInfo'
import {onMounted, ref} from "vue";

let isAdmin = ref("用户")
onMounted(function changeAdmin() {
      if (UserInfoStore.isRole == 0) {
        isAdmin.value = "用户"
      } else {
        isAdmin.value = "管理员"
      }
    }
)

const UserInfoStore = useUserInfoStore()

</script>

<style lang="scss" scoped>


.backgroundImg {
  height: 92%;
  width: 100%;
}


//卡片样式
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both
}

.box-card {
  width: 100%;
}

//文本样式区
.name-role {
  font-size: 16px;
  padding: 5px;
  text-align: center;
}

.sender {
  text-align: center;
}

.registe-info {
  text-align: center;
  padding-top: 10px;
}

.personal-relation {
  font-size: 16px;
  padding: 0px 5px 15px;
  margin-right: 1px;
  width: 100%
}

.relation-item {
  padding: 12px;

}

.dialog-footer {
  padding-top: 10px;
  padding-left: 10%;
}

//布局样式区
.el-row {
  margin-bottom: 20px;

  &:last-child {
    margin-bottom: 0;
  }
}

.el-col {
  border-radius: 4px;

}


.bg-purple-dark {
  background: #99a9bf;
}

.bg-purple {
  background: #d3dce6;
}

.bg-purple-light {
  background: #e5e9f2;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}

.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>
